import router from '@system.router';

export default {
    data: {
        baseImageUrl: '',
        token: '',
        user: {}
    },
    onInit() { //'common/temp/'
        this.baseImageUrl = this.$app.$def.globalData.baseImageUrl;
    },
    onShow() {
        this.user = this.$app.$def.globalData.user;
    },
    goBack() {
        router.back();
    },
    modify(column) {
        let data = null;
        let title = '';
        switch (column) {
            case 'nickname':
                title = '昵称';
                data = this.user.nickname;
                break;
            case 'password':
                title = '密码';
                data = this.user.password;
                break;
            case 'email':
                title = '邮箱';
                data = this.user.email;
                break;
            case 'phone':
                title = '手机';
                data = this.user.phone;
                break;
            case 'qqNumber':
                title = 'QQ号码';
                data = this.user.qqNumber;
                break;
            case 'signature':
                title = '个性签名';
                data = this.user.signature;
                break;
        }
        router.push({
            uri: 'pages/editInfo/editInfo',
            params: {
                column,
                title,
                data,
                currentUser: this.user
            }
        });
    }
}
